package com.demo.springSecurityJwt.controller;

import com.demo.springSecurityJwt.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hanson
 * @date 2022/9/13 14:57
 */
@RestController
public class RedisController {

    @Autowired
    private RedisService redisService;

    @RequestMapping(value = "/putRedis")
    public String putString(String key, String value){
        redisService.addKey(key,value);
        return "操作redis成功(新增key)";
    }

    @RequestMapping(value = "/getRedis")
    public String getString(String key){
        String str = redisService.getValueByKey(key);
        return "key: "+key+"  value:"+str;
    }
}

